#ifndef NR_ROLE_H
#define NR_ROLE_H

/**
 * @file nr_role.h
 * @brief Role
 */

#include "nr_object.h"
#include "nr_object_link.h"

/**
 * This class define the role
 *
 * The role contains the device list and the permission
 */
class nr_role : public nr_object,  public nr_permissionable
{
public:
    /**
     * Default constructor
     */
    nr_role(QString& name) : m_name(name)
    { }

    /**
     * Destructor
     */
    ~nr_role() { }

    /**
     * Get or set the name of the role
     * 
     * @return The name reference 
     */
    QString name() { return m_name; }

    /**
     * Get the device list root, default is empty
     * In the role, the device item or group only need to know
     * the id, it used as a link, find the real data in nr_device_manager
     *
     * @return The top level item reference
     */
    nr_object_link& link() { return m_link; }
    
private:
    QString m_name;
    nr_object_link m_link;
};

/**
 * The role list
 */
typedef QHash<QString, nr_role*> nr_roles;

#endif // NR_ROLE_H
